import Api from "./request";

// 添加文章接口
export const postArticleApi = <T>(data: any) => Api.post<T>('/article', data)

// 查询所有文章接口
export const getArticleListApi = <T>(params: any) => Api.get<T>('/article', params)

// 查询某一条文章接口
export const getArticleOneApi = <T>(id: string) => Api.get<T>(`/article/${id}`)

// 查询文章一级评论接口
export const getArticleCommentApi = <T>(id: string, params: any) => Api.get<T>(`article/comment/${id}`, params)

// 查询文章二级评论接口
export const getArticleCommentReplayApi = <T>(id: string, params: any) => Api.get<T>(`article/comment/replay/${id}`, params)

// 添加一二级评论接口
export const postArticleCommentApi = <T>(data: any) => Api.post<T>(`article/comment`, data)

// 文章点赞接口
export const postArticleLikeApi = <T>(id: string) => Api.post<T>(`article/like/${id}`)

// 文章删除点赞接口
export const deleteArticleLikeApi = <T>(id: string) => Api.delete<T>(`article/like/${id}`)

// 文章收藏接口
export const postArticleCollectApi = <T>(id: string) => Api.post<T>(`article/collect/${id}`)

// 文章取消收藏接口
export const deleteArticleCollectApi = <T>(id: string) => Api.delete<T>(`article/collect/${id}`)